package cn.enjoy.redisson.props;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author K
 * @date 2021/8/12 下午8:25
 */
@Data
@ConfigurationProperties(prefix = "redisson")
public class RedissonProperties {

    private int timeout = 3000;

    private String address;

    private String password;

    private int database = 0;

    private int connectionPoolSize = 20;

    private int connectionMinimumIdleSize = 10;

    private int slaveConnectionPoolSize = 20;

    private int masterConnectionPoolSize = 20;

    //哨兵配置
    private String masterName;
    private String[] sentinelAddresses;

    //主从配置 连接数不能小于最小空闲连接数
    private String masterAddress;
    private String[] slaveAddress;
    private int slaveConnectionMinimumIdleSize = 10;
    private int masterConnectionMinimumIdleSize = 10;

    public void setSentinelAddresses(String sentinelAddresses) {
        this.sentinelAddresses = sentinelAddresses.split(",");
    }

//    private List<RedisClient> client = new ArrayList<>();
}